package liangtWorkSpace.vaild;

import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;

@Data
@Accessors(chain = true)
public class User {

    @NotNull(message="id不能为空",groups = {ValidType.Update.class,ValidType.Delete.class})
    private Long id;

    @NotNull(message="username不能为空",groups = {ValidType.Add.class,ValidType.Update.class})
    @NotBlank(message="username不能为空",groups = {ValidType.Add.class,ValidType.Update.class})
    private String username;

    @Email(message = "邮箱格式不正确",groups = {ValidType.Add.class,ValidType.Update.class})
    @NotNull(message="邮箱不能为空",groups = {ValidType.Add.class,ValidType.Update.class})
    @NotBlank(message="邮箱不能为空",groups = {ValidType.Add.class,ValidType.Update.class})
    private String email;
}